package com.samehope.ar.mapper;

import com.samehope.ar.entity.PatrolItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.samehope.ar.vo.FormSelectVO;
import com.samehope.ar.vo.ItemDetailVO;
import com.samehope.ar.vo.TreeDataVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 巡检项 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface PatrolItemMapper extends BaseMapper<PatrolItem> {

    /**
     * 根据巡检项分类查询巡检项
     * @param projectId
     * @param itemTypeId
     * @return
     */
    List<PatrolItem> findByProjectAndItemType(@Param("projectId") Long projectId,
                                              @Param("itemTypeId") Long itemTypeId);

    /**
     * 根据项目和巡检项ID查询巡检项
     * @param projectId
     * @param itemId
     * @return
     */
    ItemDetailVO findDetailByProjectAndItem(@Param("projectId") Long projectId,
                                            @Param("itemId") Long itemId);

    /**
     * 根据项目和巡检项ID查询巡检项
     * @param projectId
     * @param itemId
     * @return
     */
    PatrolItem findByProjectAndItem(@Param("projectId") Long projectId,
                                    @Param("itemId") Long itemId);

    /**
     * 根据项目和条件查询巡检项树结构
     * @param projectId
     * @param condition
     * @return
     */
    List<TreeDataVO> findItemTreeByProjectAndCondition(@Param("projectId") Long projectId,
                                                 @Param("condition") String condition);

    /**
     * 巡检项下拉菜单接口
     * @param projectId
     * @return
     */
    List<FormSelectVO> itemsForSelectByProject(Long projectId);

    /**
     * 根据点位查询巡检项树结构
     * @param projectId
     * @param pointId
     * @return
     */
    List<TreeDataVO> findItemTreeByProjectIdAndPointId(@Param("projectId") Long projectId,
                                                       @Param("pointId") Long pointId);
}
